<html>
<head><meta charset="utf-8"><title>separating From&lt;E: Error&gt; from Box&lt;dyn Error&gt; · project-error-handling · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/index.html">project-error-handling</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html">separating From&lt;E: Error&gt; from Box&lt;dyn Error&gt;</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="228018308"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228018308" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228018308">(Feb 27 2021 at 00:37)</a>:</h4>
<p>so I played with your <code>try_trait_v2</code> crater build toolchain <span class="user-mention" data-user-id="125270">@scottmcm</span> and tested out moving the <code>From</code> interconversions to be a property of a <code>Result</code> type instead of the inner <code>Error</code> and using that to <code>?</code> directly into a <code>Box&lt;dyn Error&gt;</code> equivalent that still implements the error trait</p>



<a name="228018322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228018322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228018322">(Feb 27 2021 at 00:37)</a>:</h4>
<p>it worked like a charm and I'm still working through the possible implications that could have</p>



<a name="228018388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228018388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228018388">(Feb 27 2021 at 00:38)</a>:</h4>
<p>my feeling is that this _should_ be the direction the language and error handling libraries move</p>



<a name="228018460"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228018460" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228018460">(Feb 27 2021 at 00:39)</a>:</h4>
<p>eyre for example could be updated to remove the <code>From</code> impl on <code>eyre::Report</code>, change the <code>Result</code> from a type alias to its own independent type, and add all the necessary <code>From</code> logic to the <code>Try</code> type rather than the inner report</p>



<a name="228018470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228018470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228018470">(Feb 27 2021 at 00:39)</a>:</h4>
<p>that would let <code>eyre::Report</code> interoperate much more cleanly with the rest of the ecosystem</p>



<a name="228018561"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228018561" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228018561">(Feb 27 2021 at 00:40)</a>:</h4>
<p>i think there's an impl that I can't really write that I want to, which is approximately equal to this part of my test crate</p>



<a name="228018567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228018567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228018567">(Feb 27 2021 at 00:40)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">impl</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="n">FromResidual</span><span class="o">&lt;</span><span class="nb">Result</span><span class="o">&lt;!</span><span class="p">,</span><span class="w"> </span><span class="n">BoxError</span><span class="o">&gt;&gt;</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">ResultReport</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"></span>
<span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">from_residual</span><span class="p">(</span><span class="n">inner</span>: <span class="nb">Result</span><span class="o">&lt;!</span><span class="p">,</span><span class="w"> </span><span class="n">BoxError</span><span class="o">&gt;</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">inner</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">match</span><span class="w"> </span><span class="n">inner</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="nb">Ok</span><span class="p">(</span><span class="n">_</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="fm">unreachable!</span><span class="p">(),</span><span class="w"></span>
<span class="w">            </span><span class="nb">Err</span><span class="p">(</span><span class="n">BoxError</span><span class="p">(</span><span class="n">inner</span><span class="p">))</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">inner</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="p">};</span><span class="w"></span>

<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">inner</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">match</span><span class="w"> </span><span class="n">inner</span><span class="p">.</span><span class="n">downcast</span>::<span class="o">&lt;</span><span class="n">AnyError</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="nb">Ok</span><span class="p">(</span><span class="n">inner</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="nb">Err</span><span class="p">(</span><span class="o">*</span><span class="n">inner</span><span class="p">),</span><span class="w"></span>
<span class="w">            </span><span class="nb">Err</span><span class="p">(</span><span class="n">inner</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                </span><span class="kd">let</span><span class="w"> </span><span class="n">inner</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">BoxError</span><span class="p">(</span><span class="n">inner</span><span class="p">);</span><span class="w"></span>

<span class="w">                </span><span class="kd">let</span><span class="w"> </span><span class="n">inner</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">AnyError</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                    </span><span class="n">inner</span><span class="p">,</span><span class="w"></span>
<span class="w">                    </span><span class="n">context</span>: <span class="nc">Foo</span><span class="p">,</span><span class="w"></span>
<span class="w">                </span><span class="p">};</span><span class="w"></span>

<span class="w">                </span><span class="nb">Err</span><span class="p">(</span><span class="n">inner</span><span class="p">)</span><span class="w"></span>
<span class="w">            </span><span class="p">}</span><span class="w"></span>
<span class="w">        </span><span class="p">};</span><span class="w"></span>

<span class="w">        </span><span class="n">ResultReport</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">inner</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="228018610"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228018610" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228018610">(Feb 27 2021 at 00:41)</a>:</h4>
<p>the specific types here are fillers to make the orphan rules happy, but basically when converting from a regular <code>Result&lt;!, BoxError&gt;</code> back into an <code>eyre::Result</code> it would attempt to downcast the box to an <code>eyre::Report</code>, and use that if it already was one, otherwise it wraps it</p>



<a name="228018628"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228018628" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228018628">(Feb 27 2021 at 00:41)</a>:</h4>
<p>this won't work outside of std though, because <code>Box&lt;dyn Error&gt;</code> could impl Error in the future</p>



<a name="228018634"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228018634" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228018634">(Feb 27 2021 at 00:42)</a>:</h4>
<p>so this doesn't work out perfectly</p>



<a name="228018758"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228018758" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228018758">(Feb 27 2021 at 00:43)</a>:</h4>
<p>actually, can this work just fine? I might be able to do <code>Into&lt;Box&lt;dyn Error&gt;&gt;</code> and then immediately downcast in the main generic definition</p>



<a name="228018992"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228018992" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228018992">(Feb 27 2021 at 00:46)</a>:</h4>
<p>oh yea, okay cool I think that works perfectly, so I can now remove all of this extra box stuff and just use the real Box&lt;dyn Error&gt; type</p>



<a name="228019139"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228019139" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228019139">(Feb 27 2021 at 00:48)</a>:</h4>
<p>oh gosh, this changes a lot</p>



<a name="228019149"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228019149" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228019149">(Feb 27 2021 at 00:49)</a>:</h4>
<p>very exciting</p>



<a name="228019742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228019742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228019742">(Feb 27 2021 at 00:57)</a>:</h4>
<p>One thing I really want to see if we can figure out is some path to deprecating and finally removing <code>From&lt;E: Error&gt; for Box&lt;dyn Error&gt;</code></p>



<a name="228019790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228019790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228019790">(Feb 27 2021 at 00:57)</a>:</h4>
<p>it seems like a lot of hacks would be needed to make it work though</p>



<a name="228019796"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228019796" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228019796">(Feb 27 2021 at 00:57)</a>:</h4>
<p>so thats a brainstorming session for later</p>



<a name="228023977"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228023977" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228023977">(Feb 27 2021 at 01:53)</a>:</h4>
<p><span class="user-mention silent" data-user-id="220273">Jane Lusby</span> <a href="#narrow/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E/near/228018322">said</a>:</p>
<blockquote>
<p>it worked like a charm and I'm still working through the possible implications that could have</p>
</blockquote>
<p>I don't think I follow what you tried, but I'm glad it worked well <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>
<p>Is this the "make a new result-like type" thing?</p>



<a name="228025466"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228025466" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228025466">(Feb 27 2021 at 02:20)</a>:</h4>
<p><span class="user-mention silent" data-user-id="125270">scottmcm</span> <a href="#narrow/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E/near/228023977">said</a>:</p>
<blockquote>
<p>I don't think I follow what you tried, but I'm glad it worked well <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>
<p>Is this the "make a new result-like type" thing?</p>
</blockquote>



<a name="228025468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228025468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228025468">(Feb 27 2021 at 02:20)</a>:</h4>
<p>yess</p>



<a name="228025469"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228025469" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228025469">(Feb 27 2021 at 02:20)</a>:</h4>
<p>one sec</p>



<a name="228025684"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228025684" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228025684">(Feb 27 2021 at 02:24)</a>:</h4>
<p><span class="user-mention" data-user-id="125270">@scottmcm</span> <a href="https://gist.github.com/yaahc/9fe7a7631ac35df227e2061bd5d56be3">https://gist.github.com/yaahc/9fe7a7631ac35df227e2061bd5d56be3</a></p>



<a name="228025721"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228025721" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228025721">(Feb 27 2021 at 02:25)</a>:</h4>
<p>so the idea is that we'd add a <code>Result</code> like this to eyre, remove the <code>From&lt;E: Error&gt;</code> impl on <code>eyre::Report</code>, and add an <code>Error</code> impl to it</p>



<a name="228026333"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228026333" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228026333">(Feb 27 2021 at 02:37)</a>:</h4>
<p>my mind is exploding, the possibility of all error types implementing error the way they actually should has such massive implications for the rest of the error reporting stuff we've been working on</p>



<a name="228027529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228027529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228027529">(Feb 27 2021 at 02:58)</a>:</h4>
<p>Ah, because you're no longer restricted by the <code>T: From&lt;T&gt;</code></p>



<a name="228027533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228027533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228027533">(Feb 27 2021 at 02:58)</a>:</h4>
<p>yup</p>



<a name="228027545"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228027545" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228027545">(Feb 27 2021 at 02:58)</a>:</h4>
<p>so then <code>anyhow::Error</code> and <code>eyre::Report</code> get to impl Error</p>



<a name="228027551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228027551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228027551">(Feb 27 2021 at 02:59)</a>:</h4>
<p>and you can even have them behave like normal errors</p>



<a name="228027563"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228027563" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228027563">(Feb 27 2021 at 02:59)</a>:</h4>
<p>only printing the outermost error message and returning sources like expected</p>



<a name="228027566"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228027566" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228027566">(Feb 27 2021 at 02:59)</a>:</h4>
<p>so you can wrap them in other error types</p>



<a name="228027581"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228027581" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228027581">(Feb 27 2021 at 02:59)</a>:</h4>
<p>and then they provide a <code>.report()</code> fn like <code>display()</code> on <code>Path</code> for getting a type that implements only <code>Display</code>, not <code>Error</code></p>



<a name="228027584"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228027584" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228027584">(Feb 27 2021 at 03:00)</a>:</h4>
<p>and this is what handles outputting your custom format, iterating over sources etc</p>



<a name="228027654"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228027654" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228027654">(Feb 27 2021 at 03:00)</a>:</h4>
<p>then presuming we've updated the <code>PanicInfo</code> so it can contain <code>dyn Error</code>s and made it so <code>unwrap</code> passes through the error type as a dyn Error if it impls error</p>



<a name="228027672"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228027672" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228027672">(Feb 27 2021 at 03:01)</a>:</h4>
<p>or even the custom result that you use could have an unwrap that just expects its an error</p>



<a name="228027689"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228027689" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228027689">(Feb 27 2021 at 03:01)</a>:</h4>
<p>the panic handler can downcast the error back to the <code>eyre::Report</code> type concretely to do its custom reporting, or treat it like any other error if it doesn't recognize the static type</p>



<a name="228027692"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228027692" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228027692">(Feb 27 2021 at 03:01)</a>:</h4>
<p>so now we can easily preserve additional context we tack onto errors</p>



<a name="228027752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228027752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228027752">(Feb 27 2021 at 03:02)</a>:</h4>
<p>and the <code>FromResidual</code> lets us pass through <code>std::result::Result</code> easily without re-wrapping ourself multiple times and re-capturing the backtrace</p>



<a name="228027755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228027755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228027755">(Feb 27 2021 at 03:02)</a>:</h4>
<p>by checking a downcast each time we create our residual from a box&lt;dyn Error&gt;</p>



<a name="228027811"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228027811" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228027811">(Feb 27 2021 at 03:03)</a>:</h4>
<p>Wow, this all sounds epic.  It'll be a great example to answer felix's question about why <code>FromResidual</code> should be generic, too -- I'll have to add it to the RFC :)</p>
<p>(Should I just link to this zulip thread as a reference?  Is there something better?)</p>



<a name="228027815"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228027815" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228027815">(Feb 27 2021 at 03:04)</a>:</h4>
<p>i say just link the zulip thread</p>



<a name="228027862"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228027862" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228027862">(Feb 27 2021 at 03:04)</a>:</h4>
<p>I'm working on a blog post rn for what we're planning on doing for the ecosystem</p>



<a name="228027864"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228027864" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228027864">(Feb 27 2021 at 03:04)</a>:</h4>
<p>and im basically changing everything in it to be based on these plans</p>



<a name="228027894"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228027894" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228027894">(Feb 27 2021 at 03:05)</a>:</h4>
<p>so depending on how long it takes me to write that (hard recently because depressed constantly) that will probably be a good link to include</p>



<a name="228027901"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/separating%20From%3CE%3A%20Error%3E%20from%20Box%3Cdyn%20Error%3E/near/228027901" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/separating.20From.3CE.3A.20Error.3E.20from.20Box.3Cdyn.20Error.3E.html#228027901">(Feb 27 2021 at 03:05)</a>:</h4>
<p>but until then yea, just the zulip thread imo</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>